// pages/info/info.js
import { userBehavior } from '../../behaviors/userBehavior'
import {
  request
} from '../../utils/requestUtils';
Page({
  behaviors: [userBehavior],

  // 页面的初始数据
  data: {
    // 初始化第二个面板数据
    initpanel: [
      {
        url: '/pages/order/list/list',
        title: '商品订单',
        iconfont: 'icon-dingdan'
      },
      {
        url: '/pages/order/list/list',
        title: '优惠卷',
        iconfont: 'icon-lipinka'
      },
      {
        url: '/pages/order/list/list',
        title: '退款/售后',
        iconfont: 'icon-tuikuan'
      }
    ]
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    this.getTabBar().setData({
      active: 1
    })
    this.getRiderInfo()
  },
  // 跳转到登录页面
  toLoginPage() {
    wx.navigateTo({
      url: '/pages/pre_index/index'
    })
  },
  // 跳转我的订单列表
  myOrderList() {
    // wx.navigateTo({
    //   url: '/pages/customer_order_list/index'
    // })
  },
  // 获取骑手账户信息
  async getRiderInfo() {
    const result = await request({
      url: '/api/bus/groupRiderOrder/my',
      method: "POST",
      data: {}
    });
    if (result.data.code == 200) {
      this.setData({
        form: result.data.data
      })
      console.log('merchantAccount', this.data.form)

    }
  },
  // 条状今日订单列表
  toTodyOrderList() {
    wx.navigateTo({
      url: '/pages/rider_my/todyOrderList/index',
    })
  },
  // 跳转订单统计
  toOrderReport() {
    wx.navigateTo({
      url: '/pages/rider_report/index',
    })
  }
})
